package com.niguang.govt.admin.api.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.niguang.govt.admin.api.vo.AreaTree;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 政府后台用户
 * </p>
 *
 * @author 12380
 * @since 2018-12-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class GovtUser extends Model<GovtUser> {

    public static final String ID = "id";
    public static final String USER_NAME = "user_name";
    public static final String USER_ACCOUNT = "user_account";
    public static final String USER_PWD = "user_pwd";
    public static final String CITY_AUTH = "city_auth";
    public static final String LEVE = "leve";
    public static final String CREATE_TIME = "create_time";
    public static final String UPDATE_TIME = "update_time";
    public static final String DEL_FLAG = "del_flag";
    private static final long serialVersionUID = 1L;
    private Long id;
    /**
     * 用户名称
     */
    @NotBlank(message = "用户名称不能为空！")
    private String userName;
    /**
     * 用户登录账号
     */
    @NotBlank(message = "用户登录账号不能为空！")
    private String userAccount;
    /**
     * 用户密码
     */
    @JsonIgnore
    private String userPwd;
    /**
     * 用户拥有的城市权限，多个分号分隔
     */
    @NotBlank(message = "请至少为创建的用户添加一个城市区域权限")
    @JsonIgnore
    private String cityAuth;
    /**
     * 1--超级用户 2-超级用户创建的用户
     */
    private Integer leve;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonIgnore
    private LocalDateTime updateTime;
    @TableLogic
    @JsonIgnore
    private Boolean delFlag;
    @TableField(exist = false)
    private String authorization;
    @TableField(exist = false)
    private List<AreaTree> areaTree;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
